package basic50.tweentieth;

import java.text.ParseException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;

public class Basic14 {
    public static void main(String[] args) throws ParseException {
/*        题目：输入某年某月某日，判断这一天是这一年的第几天？
        程序分析：以3月5日为例，应该先把前两个月的加起来，然后再加上5天即本年的第几天，特殊情况，闰年且输入月份大于3时需考虑多加一天。*/
        Scanner sc = new Scanner(System.in);
        String date = sc.nextLine();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate localDate = LocalDate.parse(date,formatter);
        int year = localDate.getYear();
        int month = localDate.getMonthValue();
        int day = localDate.getDayOfMonth();
       if(year %4==0 && year %100 != 0 || year %400==0) {
           for (int i = 1; i < month; i++) {
               if(i==2){
                   day+=29;
               }else if(i==8||i==10){
                   day+=31;
               }else if(i%2==0 || i ==9 || i==11){
                   day+=30;
               }else{
                   day+=31;
               }
           }
           System.out.println(day);
       }
       else{
           for (int i = 1; i < month; i++) {
               if(i==2){
                   day+=28;
               }else if(i==8||i==10){
                   day+=31;
               }else if(i%2==0 || i ==9 || i==11){
                   day+=30;
               }else{
                   day+=31;
               }
           }
           System.out.println(day);
       }
    }
}
